package com.wgy.day29多线程.线程安全问题举例;

/**
 * Created by pc on 2020/11/27 22:04
 * Description: LearningJava
 */

 class RunnableImpl implements Runnable {
    private int ticket=100;

    @Override
    public void run() {
        while(true){
            if(ticket>0){
                System.out.println(Thread.currentThread().getName()+"-->正在买第"+ticket+"张票");
                ticket--;

            }
        }
    }
}
